<?php require_once("includes/security.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>קליניקה נטורופתית</title>
<?php
require_once("includes/initializeSession.php");
require("includes/openConnection.php");
if(isset($_POST['loginSubmit'])  )
{
	 
	$result = mysql_query ("SELECT * FROM users WHERE username = '{$_POST['username']}' AND psw = '{$_POST['password']}' AND block = '0' LIMIT 1");
	if (mysql_num_rows($result)) 
	{
		 $_SESSION['UserName']=$_POST['username'];
		 //echo "התחברת בהצלחה";
	}
	else
	{
		echo "תקלה בהתחברות";
	}
}

require("includes/closeConnection.php");
?>
</head>

<body>
<container id="container">
  <?php require("header.php"); ?>
      <content id="content">
      <contentTitle id="contentTitle">
      התחברות
      </contentTitle>
      <contentText id="contentText">
      <?php   if (!isset($_SESSION['UserName'])) {?>
      <form  action="" method="post" >
 <table>
 <tr>
 <td>     שם משתמש:</td>
           <td> <input class="field" style="width: 100px" type="text" id="username" name="username" maxlength="20" /></td>
            </tr><tr>
            <td>סיסמא:</td>
            <td><input class="field" style="width: 100px" type="password" id="password" name="password" maxlength="20" /></td>
            </tr><tr>
            <td>
            <input type="submit" value="התחבר" id="loginSubmit" name="loginSubmit" class="bt_login_InToPanel" /></td>
            <td><a href="forgotPsw.php"  >שכחת סיסמא?</a></td>
            </tr>
            </table>
          </form>
          <?php }
		  else {
		  ?>
         התחברת בהצלחה
             <?php }?>
</contentText>
      </content>
</container>
    
     
    
</body>
</html>
